package com.pervasa.demo.re.impl.command;

public class Token {
	public static enum Kind {
		IDENT,
		/* keywords */
		_TRUE, _FALSE, SET, DEFINE, LIST, BASIC, RUN, STOP, 
		LOAD, EVENT, CONDITION, ACTION, RULE, CLEAR, NIL, INF, 
		/* int_literal */
		INT_LITERAL,
		/* . | ; | , | ( | ) | [ | ] | \\ */
		DOT, SEMI, COMMA, LPAREN, RPAREN, LSQUARE, RSQUARE, BACKDASH,
		/* = | + | * | */
		BECOMES, PLUS, TIMES,
		/* < | > | % | / | - | : */
		LANGLE, RANGLE, PERCENT, SLASH, MINUS, COLON, 
		/* end of file */
		EOF
	}

	public final Kind kind;

	public Token(Kind kind) {
		this.kind = kind;
	}

	public String toString() {
		return kind + "";
	}

	// override equals method from java.lang.object to compare values
	public boolean equals(Object t) {
		if (this == t) {
			return true;
		} // comparing same targetExpr
		if ((t == null) || (t.getClass() != this.getClass())) {
			return false;
		}
		Token other = (Token) t;
		return (kind == other.kind || ((kind != null) && kind
				.equals(other.kind)));
	}

	// override hashCode from java.lang.Object to maintain consistency with
	// equals
	public int hashCode() {
		if (kind == null)
			return 0;
		return kind.hashCode();
	}

}
